package com.loveyukari.utils;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.loveyukari.common.exception.InternalException;

/**
*
*yangshaohua
*2017年1月11日下午6:32:52
**/
public class HeyskySendUtils {

	private static Logger log = LoggerFactory.getLogger(HeyskySendUtils.class);
	private static String API_URL = "http://api2.santo.cc/submit";
	private static final String CPID = "zutkvc";
	private static final String CPPWD = "kbvKSCbn";
	
	
	public static void sendMessage(String content,String phone){
		try {
			Map<String,Object> params = new HashMap<String,Object>();
			params.put("command", "MT_REQUEST");
			params.put("cpid", CPID);
			params.put("cppwd", CPPWD);
			params.put("da", phone);
			params.put("dc", 15);
			params.put("sa", "yukari");
			String send = HeyskyUtils.encodeHexStr(15, content);
			params.put("sm", send);
			String result = HttpUtils.sendPost(API_URL, params);
			System.out.println(result);
			log.info(result);
		} catch (Exception e) {
			log.error(e.getMessage(),e);
		}
	}
	
	public static void callMessage(String phone){
		try {
			Map<String,Object> params = new HashMap<String,Object>();
			params.put("command", "VO_REQUEST");
			params.put("cpid", CPID);
			params.put("cppwd", CPPWD);
			params.put("da", phone);
			params.put("dc", 15);
			params.put("sm", HeyskyUtils.encodeHexStr(15, "开播啦"));
			params.put("lang", "zh-cn");
			String result = HttpUtils.sendPost(API_URL, params);
			System.out.println(result);
			log.info(result);
		} catch (Exception e) {
			log.error(e.getMessage(),e);
		}
	}
	
	public static void main(String[] args) {
		sendMessage("键盘收到请群里回复一下","19495379618");
	}
	
	
}
